import React from 'react';
import { Flex as AntdFlex } from 'antd';
import type { FlexProps as AntdFlexProps } from 'antd';
import { createStyles } from 'antd-style';

export interface FlexProps extends AntdFlexProps {
  /**
   * @description 自定义样式类名
   */
  customClassName?: string;
}

const useStyles = createStyles(({ token, css }) => ({
  flex: css`
    display: flex;
  `,
}));

const Flex: React.FC<FlexProps> = ({ customClassName, className, ...restProps }) => {
  const { styles, cx } = useStyles();
  
  const flexClassName = cx(
    className,
    customClassName,
    styles.flex
  );

  return <AntdFlex className={flexClassName} {...restProps} />;
};

export { Flex };
export default Flex;

